#include "d3dApp.h"
#include "Light.h"
#include "RenderContext.h"

class ContentManager;
class Level;
class GraphCamera;
class Sphere;
class PhysX;
class TrianglePosColor;
class QuadPosColor;
class Character;
class Terrain;
class SkyBox;
class DrawableTex2D;
class FullscreenQuad;
class Water;
class SkyModel;
class FogInfo;

class TestGameApp : public D3DApp
{
public:
	TestGameApp(HINSTANCE hInstance);
	~TestGameApp();

	virtual void InitApp();
	virtual void OnResize();
	virtual void UpdateScene(const InputState & m_pInputState);
	virtual void DrawScene(); 

private:
	//private functions
	void ResetRenderTargets();
	void DrawRefractionMap();
	void RenderRefraction(const RenderContext* pRenderContext, float waterheight);
	void RenderReflection(const RenderContext* pRenderContext, float waterheight);
	void RenderShadowDepthMap(const RenderContext* pRenderContext);
	D3DXPLANE CreatePlane(D3DXVECTOR3 &point, D3DXVECTOR3 &normal);

	//private vars
	PhysX *m_pPhysX;
	Level *m_pLevel;
	GraphCamera *m_pGraphCamera;
	Character* m_pCharacter;
	Sphere *m_pSphere;
	TrianglePosColor* m_pTrianglePosColor;
	QuadPosColor* m_pQuadPosColor;
	float m_Angle;
	Light m_DirLight;

	Terrain* m_pTerrain;
	SkyBox* m_pSkyBox;

	//Water
	DrawableTex2D* m_pRefractionPtr;
	DrawableTex2D* m_pReflectionPtr;
	
	ID3D10ShaderResourceView* m_pRefractionTexturePtr;
	ID3D10ShaderResourceView* m_pReflectionTexturePtr;
	
	FullscreenQuad* m_pFullScreenPtr;
	Water* m_pWaterPtr;

	//Skydome
	SkyModel* m_pSkymodel;
	RenderContext::DistanceFog m_FogInfo;

	//Shadowmap stuff
	ID3D10ShaderResourceView* m_pShadowDepthTexturePtr;
	DrawableTex2D* m_pShadowDepthMapPtr;
	GraphCamera *m_pOrthoCamera;
};